package homework.yuandan.controller;

import homework.yuandan.common.ResponseEnum;
import homework.yuandan.common.annotation.AuthRight;
import homework.yuandan.common.vo.ResultVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 作者:49293
 * 时间:2021/1/6-14:46
 *
 * @author 49293
 */
@RestController
@CrossOrigin
@RequestMapping("/admin")
public class TestController {
    /**
     *   如果要能执行这个方法当前的角色必须具备TEST_SEARCH 权限碑
     */
    @GetMapping("/right/test/search/check")
    @ApiOperation("测试TEST_SEARCH权限")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "X-Token", required = true, paramType = "header"),
    })
    @AuthRight(rightCode = "TEST_SEARCH")
    public ResultVO<Void> testSearch() {
        return new ResultVO<>(ResponseEnum.SUCCESS_SERVER);
    }
    /**
     *   如果要能执行这个方法当前的角色必须具备TEST_AUDIT 权限碑
     */
    @ApiOperation("测试TEST_AUDIT权限")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "X-Token", required = true, paramType = "header"),
    })
    @GetMapping("/right/test/audit/check")
    @AuthRight(rightCode = "TEST_AUDIT")
    public ResultVO<Void> testAudit() {

        return new ResultVO<>(ResponseEnum.SUCCESS_SERVER);
    }
}
